package com.jxl.domain.convert;

import com.jxl.domain.entity.SubjectInfoBO;
import com.jxl.domain.entity.SubjectOptionBO;
import com.jxl.infra.basic.entity.SubjectInfo;
import com.jxl.infra.basic.es.entity.SubjectInfoEs;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface SubjectInfoConvert {

    SubjectInfoConvert INSTANCE = Mappers.getMapper(SubjectInfoConvert.class);

    /**
     * 类转换
     * @param subjectInfoBO
     * @return
     */
    SubjectInfo convertBOToSubjectInfo(SubjectInfoBO subjectInfoBO);

    @Mappings({
            @Mapping(target = "subjectAnswer",source = "subjectOptionBO.subjectAnswer")
    })
    SubjectInfoBO convertOptionAndInfoToBo(SubjectOptionBO subjectOptionBO,SubjectInfo subjectInfo);

    List<SubjectInfoBO> convertToSubjectInfoBO(List<SubjectInfo> subjectInfos);

    SubjectInfoEs conertSubejctInfoToSubejctEs(SubjectInfo subjectInfo);

}
